"""
Convert static species data to rows in a separate table

"""

#################### Set up Django environment
import sys,os
from datetime import *


os.environ['DJANGO_SETTINGS_MODULE'] ='treedata.settings'

from django.core.management import setup_environ
from treedata import settings
setup_environ(settings)

#################### Import models from Django project

from trees.models import *
from django.contrib.auth.models import User, Group
import datetime, time
#################### Start work

# 43376
plants = Plant.objects.filter(id__gt=48372).exclude(planting_date_o='')

for p in plants:
    if p.planting_date_o:
        print p.id
        c = time.strptime(p.planting_date_o,"%m/%d/%y")
        print c
        # p.planting_date = date(c.year,c.month,c.date)
        p.planting_date = datetime.date(c[0],c[1],c[2])
        p.save()
        print "---------"
        print
        

  
        
    
        
 
        
                      
